home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / applications / wp / textra16.lha / Textra116 / Scripts / AddIcon.textra next >
Encoding:
Text File  |  1994-09-30  |  1.5 KB  |  62 lines

  1. /*
  2. ** AddIcon - Create an icon for the currently opened file.
  3. **
  4. **   Usage:   AddIcon
  5. **
  6. ** This script accepts no arguments, but works for the current file.
  7. **
  8. ** Mike Haas, Sep 30, 1994
  9. **
  10. ** This file assumes that the user has created a directory called
  11. ** "sys:System/icons" and has created in there a Project-type icon file
  12. ** called "Text.info".  The default tool for the icon should point
  13. ** to Textra.  (I recommend "Unsnapshot"-ing the icon from Workbench...
  14. ** selected it and pull down "Icon, UnSnapshot").  This script uses that
  15. ** icon file as a model for all created icons.
  16. **
  17. ** Once the user has done this, he/she need only execute this script
  18. ** and a double-clickable Icon for the current text file will appear,
  19. ** launching Textra on that file when launched.
  20. */
  21.  
  22. options results
  23.  
  24. /*
  25. ** If you wish to change the place the icon is looked for, do it here.
  26. */
  27. IconFile = "sys:System/icons/Text.info"
  28.  
  29. /*
  30. ** does the icon file exist?
  31. */
  32. result = open('iconf',IconFile,'R')
  33. if (result = 0) then do
  34.     notify '"Cant find 'IconFile'"'
  35.     exit
  36. end
  37. result = close('iconf')
  38.  
  39. /*
  40. ** Put together the new icon file name
  41. */
  42. get file path
  43. NewFile = result
  44. get file name
  45. NewFile = overlay(result,NewFile,length(NewFile)+1)
  46. NewFile = overlay('.info',NewFile,length(NewFile)+1)
  47.  
  48. /*
  49. ** Check if the NewFile exists already...
  50. */
  51. result = open('iconf',NewFile,'R')
  52. if (result = 1) then do
  53.     notify '"Icon for this file already exists"'
  54.     result = close('iconf')
  55.     exit
  56. end
  57.  
  58. /*
  59. ** Use the AmigaDOS copy command...
  60. */
  61. address command "copy quiet "IconFile" "NewFile
  62.